const express = require('express');
const path = require('path');
const app = express(); 
<%#列表渲染外部依赖 -%> 
<% Object.keys(modules).forEach(m => { -%> 
const <%- m %> = require('<%- modules[m] %>');
<%}) -%>
<%#列表渲染内部依赖 -%> 
<% Object.keys(localModules).forEach(m => { -%> 
const <%- m %> = require('<%- localModules[m] %>');
<%}) -%>
<%#设置模板引擎 -%> 
// view engine setup
app.set('views', path.resolve(__dirname, 'views'));
app.set('view engine', 'ejs');
<%#设置静态文件目录 -%>
app.use(express.static('public')) 
<%#列表渲染中间件 -%> 
<% uses.forEach(c => { -%> 
app.use(<%- c -%>); 
<%}) -%>
<%#列表渲染路由中间件 -%> 
<% mounts.forEach(c => { -%> 
app.use('<%- c.path %>', <%- c.code -%>); 
<%}) -%>
<%#列表渲染路由中间件 -%> 
// 错误处理
app.use(function(req, res, next) {
    res.render('error', {
        message: '404 not found',
        error: {
            status: 404,
            stack: ''
        }
    })
});
app.listen(<%- port %>, () => {
    console.log(`Example app listening on <%- port %>`)
})